{include file="public/header" /}

<div class="page">
    <form id="goods_storage_form" enctype="multipart/form-data" method="post">
        <input type="hidden" name="goods_id" id="goods_id" value="{$goods_info.goods_id}" />
        <table class="sc-default-table">
            <tbody>
                <tr class="noborder">
                    <td class="required w120"><label for="goods_order">采购单号:</label></td>
                    <td class="vatop rowform" width="150"><input type="text" id="goods_order" name="goods_order" class="txt"></td>
                </tr>
                <tr class="noborder">
                    <td class="required"><label for="goods_nums">库存数量:</label></td>
                    <td class="vatop rowform"><input type="text" id="goods_nums" name="goods_nums" class="txt">正数加库存，负数减库存</td>
                </tr>
                <tr class="noborder">
                    <td class="required"><label for="remarks">备注:</label></td>
                    <td class="vatop rowform"><textarea type="text" id="remarks" name="remarks" class="txt"></textarea></td>
                </tr>
            </tbody>
            <tfoot>
                <tr class="tfoot">
                    <td colspan="15"><a href="JavaScript:void(0);" class="btn" id="submitBtn"><span>{$Think.lang.sc_submit}</span></a></td>
                </tr>
            </tfoot>
        </table>
    </form>

    <script type="text/javascript" src="{$Think.PLUGINS_SITE_ROOT}/mlselection.js" charset="utf-8"></script>
    <script type="text/javascript">
        $(function() {
            $("#region").sc_region();
            $("#submitBtn").click(function() {
                let goods_id = $("#goods_id").val();
                let goods_order = $("#goods_order").val();
                let goods_nums = $("#goods_nums").val();
                let remarks = $("#remarks").val();
                if(goods_nums==null || goods_nums==undefined || goods_nums=="" || goods_nums==0 || remarks=="" || remarks==null){
                    layer.alert("库存数量或备注为必填项");
                }
                $.getJSON('{:url("goods_sn_storage_save")}' , {goods_id:goods_id,goods_order:goods_order,goods_nums:goods_nums,remarks:remarks}, function(date){
                    let res = eval('(' + date + ')');
                    if(res.code=="1000"){
                        // layer.alert("操作成功");
                        let index = parent.layer.getFrameIndex(window.name);
                        layer.msg('操作成功');//下面是关键代码
                        setTimeout(function () { parent.layer.close(index) }, 500);//延迟
                    }else{
                        layer.alert(res.msg);
                    }
                });
            });
        });
    </script>
</div>
